This page last changed on Jun 21, 2009 by stepheneb.

Login to the Apple Developer Connection: (If you don't have an account create one – it is free.)

Go to the downloads page, select the Java category and download and install:

  • Java for Mac OS X 10.5 Update 2 Developer Documentation (Disk Image)

If a newer release is available download that instead.

The source code for each version of Java for the Mac can be found here:

Java version path to source jar
1.4.2 /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/src.jar
1.5.x /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/src.jar
1.6.x /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/src.jar

Eclipse

These jar files can be used as source attachments in eclipse.

XCode

Using Doxygen to create XCode Documentation Sets. Also see this thread.

Extracting Javadoc

The following shell script can be used to extract the Mac OS X source and Javadoc files in a separate directory. After extracting the resources from the jar files the script opens three new windows in Safari with all of the root index.html nodes for the three different versions of Java. In addition Finder windows are opened for the directories created for the three Java versions.

extract_mac_java_developer_resources.sh
Unable to find source-code formatter for language: shell. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
#!/bin/sh
MAC_JAVA_HOMES=/System/Library/Frameworks/JavaVM.framework/Versions/

# edit the value of this variable to refer to the destination directory
NEW_JAVADOC_LOCATION=~/dev/macjava

# make destination dirs
mkdir -p $NEW_JAVADOC_LOCATION/1.4.2
mkdir -p $NEW_JAVADOC_LOCATION/1.5.0
mkdir -p $NEW_JAVADOC_LOCATION/1.6.0

# copy jars
echo "\nCopying Mac OS X Java jar resources into:\n"
echo "  $NEW_JAVADOC_LOCATION/1.4.2 ..."
cp $MAC_JAVA_HOMES/1.4.2/Home/*.jar $NEW_JAVADOC_LOCATION/1.4.2/
echo "  $NEW_JAVADOC_LOCATION/1.5.0 ..."
cp $MAC_JAVA_HOMES/1.5.0/Home/*.jar $NEW_JAVADOC_LOCATION/1.5.0/
echo "  $NEW_JAVADOC_LOCATION/1.6.0 ..."
cp $MAC_JAVA_HOMES/1.6.0/Home/*.jar $NEW_JAVADOC_LOCATION/1.6.0/

# extract jars
cd $NEW_JAVADOC_LOCATION/1.4.2
echo "\nExtracting/updating javadoc and source resources into:\n"
echo "  $NEW_JAVADOC_LOCATION/1.4.2 ..."
ls *.jar | xargs -n1 unzip -qu
cd $NEW_JAVADOC_LOCATION/1.5.0
echo "  $NEW_JAVADOC_LOCATION/1.5.0 ..."
ls *.jar | xargs -n1 unzip -qu
cd $NEW_JAVADOC_LOCATION/1.6.0
echo "  $NEW_JAVADOC_LOCATION/1.6.0 ..."
ls *.jar | xargs -n1 unzip -qu
echo

# open 1.4.2 javadoc index pages in Safari
osascript -e "tell application \"Safari\" to make new document with properties \
  {URL:\"$NEW_JAVADOC_LOCATION/1.4.2/doc/api/index.html\"}"
cd $NEW_JAVADOC_LOCATION/1.4.2
open -a Safari appledoc/api/index.html \
  doc/guide/2d/api-jpeg/index.html \
  doc/guide/jpda/jdi/index.html \
  doc/guide/plugin/dom/index.html \
  doc/guide/security/jgss/spec/index.html \
  doc/guide/security/jaas/spec/index.html
osascript -e 'tell front window of app "Safari" to set current tab to tab 1'

# open 1.5.0 javadoc index pages in Safari
osascript -e "tell application \"Safari\" to make new document with properties \
  {URL:\"$NEW_JAVADOC_LOCATION/1.5.0/doc/api/index.html\"}"
cd $NEW_JAVADOC_LOCATION/1.5.0
open -a Safari appledoc/api/index.html \
  doc/guide/2d/api-jpeg/index.html \
  doc/guide/jpda/jdi/index.html \
  doc/guide/security/jgss/spec/index.html \
  doc/guide/security/jaas/spec/index.html \
  doc/guide/plugin/dom/index.html \
  doc/tooldocs/apt/mirror/index.html \
  doc/tooldocs/javadoc/doclet/index.html \
  doc/guide/management/extension/index.html
osascript -e 'tell front window of app "Safari" to set current tab to tab 1'

# open 1.6.0 javadoc index pages in Safari
osascript -e "tell application \"Safari\" to make new document with properties \
  {URL:\"$NEW_JAVADOC_LOCATION/1.6.0/docs/api/index.html\"}"
cd $NEW_JAVADOC_LOCATION/1.6.0/
open -a Safari appledoc/api/index.html \
  docs/jdk/api/apt/mirror/index.html \
  docs/jdk/api/attach/spec/index.html \
  docs/jdk/api/javac/tree/index.html \
  docs/jdk/api/jconsole/spec/index.html \
  docs/jre/api/security/jgss/spec/index.html \
  docs/jre/api/net/httpserver/spec/index.html \
  docs/jre/api/security/jaas/spec/index.html \
  docs/jre/api/plugin/dom/index.html \
  docs/jre/api/management/extension/index.html \
  docs/jre/api/security/smartcardio/spec/index.html \
  docs/jdk/api/javadoc/doclet/index.html \
  docs/jdk/api/jpda/jdi/index.html
osascript -e 'tell front window of app "Safari" to set current tab to tab 1'

# open new directories in Finder
open $NEW_JAVADOC_LOCATION/1.4.2/
open $NEW_JAVADOC_LOCATION/1.5.0/
open $NEW_JAVADOC_LOCATION/1.6.0/
Document generated by Confluence on Jan 27, 2014 16:56